package com.zhangc.blog.base.validator;

import org.springframework.beans.factory.InitializingBean;

/**
 * 功能描述:<br>
 *
 * @author wx:fdzhangc
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
public abstract class AbstractServiceExceptionFactory implements ServiceExceptionFactory, InitializingBean {
    @Override
    public ServiceException create(ServiceExceptionNameProvider var1, Object... var2) {
        return new ServiceException(var1.getName(), var2);
    }

    @Override
    public ServiceException create(ErrorInfoProvider var1, Object... var2) {
        return new ServiceException(var1.getErrorCode(), var1.getErrorMsg(), var2);
    }

    @Override
    public boolean isI18nEnabled() {
        return true;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        Validators.setServiceExceptionFactory(this);
    }
}
